//
//  TKAuctioneerManagementListController.m
//  Ticket
//
//  Created by 小禹宝宝 on 2017/10/27.
//  Copyright © 2017年 cy55. All rights reserved.
//

#import "TKAuctioneerManagementListController.h"
#import "AuctionManagerListCell.h"
#import "TKGoodsListResquest.h"
#import "BLBaseListViewDataController.h"

@interface TKAuctioneerManagementListController ()
@property (nonatomic, strong) BLBaseListViewDataController *dataSource;

@end

@implementation TKAuctioneerManagementListController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"卖家拍品管理";
    [self ks_setupLeftBackBarButtonItemWithColor:nil];
    TKGoodsListResquest *request = [TKGoodsListResquest new];
    request.category_id = 0;
    request.sell_user_id = [TKAccountManager sharedManager].accountInfo.result.info.user_id;
    
    _dataSource = [[BLBaseListViewDataController alloc] initWithRequest:request decodeClass:[TKGoodsListResponse class] afterParseCompletion:^(id responseObject) {
        DDLogInfo(@"responseObject ----:%@",responseObject);
        
        DDLogInfo(@"responseObject ---- list:%@",[(TKGoodsListResponse *)responseObject list]);
    }];
    
    self.listView.pagingListDataSource = _dataSource;
    self.listView.rowHeight = 180;
    [self.listView registerNib:[UINib nibWithNibName:@"AuctionManagerListCell" bundle:nil] forCellReuseIdentifier:@"AuctionManagerListCell"];

}

#pragma mark - UITableViewDataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.listView.dataItems.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    AuctionManagerListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AuctionManagerListCell" forIndexPath:indexPath];
    TKGoodsItem *item = self.listView.dataItems[indexPath.row];
    cell.model = item;
//    cell.statusBlock = ^(BOOL isSuccess) {
//        if (isSuccess) {
//            [self.listView reloadData];
//        }
//    };
    return cell;
}

#pragma mark - UITableViewDelegate

//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
//{
//    return 80;
//}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    TKGoodsItem *item = self.listView.dataItems[indexPath.row];
//    TKTieziDetailViewController *detailVc = [TKTieziDetailViewController new];
//    detailVc.goodsID = item.id;
//    [KSNavi push:detailVc];
}




@end
